//
//  SlideBackViewController.m
//  JianChaRiBao
//
//  Created by yuzhou on 13-5-20.
//  Copyright (c) 2013年 wzyk. All rights reserved.
//

#import "SwipeBackViewController.h"

@interface SwipeBackViewController ()
{
    UISwipeGestureRecognizer *swipeGesture;
    UISwipeGestureRecognizer *swipeLeft;

}
@end

@implementation SwipeBackViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view.
    if (swipeGesture == nil) {
        swipeGesture = [[[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeBack)] autorelease];
        swipeGesture.direction = UISwipeGestureRecognizerDirectionRight;
        [self.view addGestureRecognizer:swipeGesture];
    }
    if (swipeLeft == nil && needSwipNext == YES) {
        swipeLeft = [[[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeLeft)] autorelease];
        swipeLeft.direction = UISwipeGestureRecognizerDirectionLeft;
        [self.view addGestureRecognizer:swipeLeft];
    }
}
-(void)swipeLeft{
    
}

- (void)swipeBack
{
    if (shouldSwipeBack) {
        [self.navigationController popViewControllerAnimated:YES];
    }
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
